<template>
  <div class="employees-container">
    <div class="app-container">
      <el-card>
        <el-tabs v-model="seleted">
          <el-tab-pane name="login" label="登录账户设置">
            <LoginSetting :user-info="userInfo" />
          </el-tab-pane>
          <el-tab-pane name="detail" label="个人详情">
            <UserInfo :user-info="userInfo" />
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </div>
  </div>
</template>

<script>
import LoginSetting from './components/login-setting.vue'
import UserInfo from './components/user-info.vue'
// 获取用户信息
import { getUserDetailById } from '@/api/user'
export default {
  components: {
    LoginSetting,
    UserInfo
  },
  data () {
    return {
      seleted: 'detail',
      userInfo: {}
    }
  },
  created () {
    this.getUserInfo(this.$route.params.id)
  },
  methods: {
    async getUserInfo (id) {
      const data = await getUserDetailById(id)
      // console.log(data)
      this.userInfo = data
    }
  }

}
</script>
